Source for file SC_CartSession.php
Documentation is available at SC_CartSession.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if($key ==
"") $key =
"cart";
$this->key_tmp =
"savecart_" .
$key_tmp;
// すでに情報がなければ現状のカート情報を記録しておく
$_SESSION[$this->key_tmp] =
$_SESSION[$this->key];
foreach($_SESSION as $key =>
$val) {
if($key !=
$this->key_tmp &&
ereg("^savecart_", $key)) {
$ret = isset
($_SESSION[$this->key]['cancel_purchase'])
?
$_SESSION[$this->key]['cancel_purchase'] :
"";
$_SESSION[$this->key]['cancel_purchase'] =
false;
for($i =
1; $i <=
$max; $i++
) {
if ($_SESSION[$this->key][$i]['quantity'] !=
$_SESSION[$this->key_tmp][$i]['quantity']) {
if ($_SESSION[$this->key][$i]['id'] !=
$_SESSION[$this->key_tmp][$i]['id']) {
$_SESSION[$this->key]['cancel_purchase'] =
true;
$_SESSION[$this->key]['cancel_purchase'] =
false;
return $_SESSION[$this->key]['cancel_purchase'];
foreach($_SESSION[$this->key] as $key =>
$val){
$arrRet[] =
$_SESSION[$this->key][$key]['cart_no'];
return (max($arrRet) +
1);
for($i =
0; $i <=
$max; $i++
) {
if(isset
($_SESSION[$this->key][$i]['id'])
&&
$_SESSION[$this->key][$i]['id'] ==
$id) {
$price =
$_SESSION[$this->key][$i]['price'];
$quantity =
$_SESSION[$this->key][$i]['quantity'];
$pre_tax =
SC_Utils_Ex::sfPreTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
$total =
$pre_tax *
$quantity;
for($i =
0; $i <=
$max; $i++
) {
if(isset
($_SESSION[$this->key][$i]['id'])
&&
$_SESSION[$this->key][$i]['id'] ==
$id) {
$_SESSION[$this->key][$i][$key] =
$val;
foreach($_SESSION[$this->key] as $key =>
$val) {
for($i =
0; $i <=
$max; $i++
) {
$total+=
$_SESSION[$this->key][$i]['quantity'];
for($i =
0; $i <=
$max; $i++
) {
if (!isset
($_SESSION[$this->key][$i]['price'])) {
$_SESSION[$this->key][$i]['price'] =
"";
$price =
$_SESSION[$this->key][$i]['price'];
if (!isset
($_SESSION[$this->key][$i]['quantity'])) {
$_SESSION[$this->key][$i]['quantity'] =
"";
$quantity =
$_SESSION[$this->key][$i]['quantity'];
$total+=
($pre_tax *
$quantity);
for($i =
0; $i <=
$max; $i++
) {
$price =
$_SESSION[$this->key][$i]['price'];
$quantity =
$_SESSION[$this->key][$i]['quantity'];
$tax =
SC_Utils_Ex::sfTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
$total+=
($tax *
$quantity);
if (USE_POINT !==
false) {
for($i =
0; $i <=
$max; $i++
) {
$price =
$_SESSION[$this->key][$i]['price'];
$quantity =
$_SESSION[$this->key][$i]['quantity'];
if (!isset
($_SESSION[$this->key][$i]['point_rate'])) {
$_SESSION[$this->key][$i]['point_rate'] =
"";
$point_rate =
$_SESSION[$this->key][$i]['point_rate'];
if (!isset
($_SESSION[$this->key][$i]['id'][0])) {
$_SESSION[$this->key][$i]['id'][0] =
"";
$id =
$_SESSION[$this->key][$i]['id'][0];
$point =
SC_Utils_Ex::sfPrePoint($price, $point_rate, POINT_RULE, $id);
$total+=
($point *
$quantity);
function addProduct($id, $quantity, $campaign_id =
"") {
for($i =
0; $i <=
$max; $i++
) {
if($_SESSION[$this->key][$i]['id'] ==
$id) {
$val =
$_SESSION[$this->key][$i]['quantity'] +
$quantity;
$_SESSION[$this->key][$i]['quantity']+=
$quantity;
if(!empty($campaign_id)){
$_SESSION[$this->key][$i]['campaign_id'] =
$campaign_id;
$_SESSION[$this->key][$i]['is_campaign'] =
true;
$_SESSION[$this->key][$max+
1]['id'] =
$id;
$_SESSION[$this->key][$max+
1]['quantity'] =
$quantity;
if(!empty($campaign_id)){
$_SESSION[$this->key][$max+
1]['campaign_id'] =
$campaign_id;
$_SESSION[$this->key][$max+
1]['is_campaign'] =
true;
foreach($arrExclude as $val) {
// 除外ページでない場合は、前頁として記録する。
$_SESSION[$this->key]['prev_url'] =
$url;
return isset
($_SESSION[$this->key]['prev_url'])
?
$_SESSION[$this->key]['prev_url'] :
"";
for($i =
0; $i <
$max; $i++
) {
if($_SESSION[$this->key][$i][$keyname] ==
$val) {
unset
($_SESSION[$this->key][$i]);
$_SESSION[$this->key][$key] =
$val;
return $_SESSION[$this->key][$key];
for($i =
0; $i <=
$max; $i++
) {
if(isset
($_SESSION[$this->key][$i]['cart_no'])
&&
$_SESSION[$this->key][$i]['cart_no'] !=
"") {
$arrRet[] =
$_SESSION[$this->key][$i];
for($i =
0; $i <=
$max; $i++
) {
if($_SESSION[$this->key][$i]['cart_no'] !=
"") {
$arrRet[] =
$_SESSION[$this->key][$i]['id'][0];
for($i =
0; $i <=
$max; $i++
) {
unset
($_SESSION[$this->key][$i]);
for($i =
0; $i <=
$max; $i++
) {
if($_SESSION[$this->key][$i]['cart_no'] ==
$cart_no) {
unset
($_SESSION[$this->key][$i]);
for($i =
0; $i <=
$max; $i++
) {
if($_SESSION[$this->key][$i]['cart_no'] ==
$cart_no) {
if(strlen($_SESSION[$this->key][$i]['quantity'] +
1) <=
INT_LEN) {
$_SESSION[$this->key][$i]['quantity']++
;
for($i =
0; $i <=
$max; $i++
) {
if($_SESSION[$this->key][$i]['cart_no'] ==
$cart_no) {
if($_SESSION[$this->key][$i]['quantity'] >
1) {
$_SESSION[$this->key][$i]['quantity']--
;
function chkSoldOut($arrCartList, $is_mobile =
false){
foreach($arrCartList as $key =>
$val){
if($val['quantity'] ==
0){
SC_Utils_Ex::sfDispSiteError(SOLD_OUT, "", true, "", $is_mobile);
* @param integer $campaign_id キャンペーンID
* @return boolean True:キャンペーン商品有り False:キャンペーン商品無し
for($i =
0; $i <=
$max; $i++
) {
if($_SESSION[$this->key][$i]['is_campaign'] and $_SESSION[$this->key][$i]['campaign_id'] ==
$campaign_id) return true;
Documentation generated on Tue, 28 Apr 2009 18:13:07 +0900 by phpDocumentor 1.4.2